


package com.UMLife.me.ui;

import javax.microedition.lcdui.Image;
import com.UMLife.me.action.QuestionAction;
import com.UMLife.me.global.Global;
import de.enough.polish.ui.Choice;
import de.enough.polish.ui.ChoiceGroup;
import de.enough.polish.ui.ChoiceItem;
import de.enough.polish.ui.Container;
import de.enough.polish.ui.Form;
import de.enough.polish.ui.ImageItem;
import de.enough.polish.ui.Item;
import de.enough.polish.ui.StringItem;





public class QuestionUI
		extends Form
{
	public QuestionUI()
	{
		
		//#style QuestionUI
		super(null);
		this.question = new String("你更看重的是餐馆的方面是：");
		
		//#style question
		this.questionItem = new StringItem(null, this.question, Item.PLAIN);
		//#style con
		Container con = new Container(true);
		//#style ImageItemCon
		Container littleContainer = new Container(true);
		//#style answerGroup 
		this.answerGroup = new ChoiceGroup(null, Choice.EXCLUSIVE);
		
		for (int i = 0; i < this.answer.length; i++)
		{
			//#style listItem
			ChoiceItem item = new ChoiceItem(this.answer[i], null,
					Choice.EXCLUSIVE);
			this.answerGroup.append(item);
		}
		
		try
		{
			Image tips = Image.createImage("/tips.png");
			//#style tipsButton
			this.tipsItem = new ImageItem(null, tips, Item.PLAIN, null);
			Image go = Image.createImage("/go.png");
			//#style tipsButton
			this.goItem = new ImageItem(null, go, Item.PLAIN, null);
			littleContainer.add(this.tipsItem);
			littleContainer.add(this.goItem);
		} catch (Exception e)
		{
			e.printStackTrace();
		}
		con.add(this.questionItem);
		con.add(this.answerGroup);
		con.add(littleContainer);
		this.append(Global.getGlobalLogo());
		this.append(con);
		
		//杨光添加的事件响应
		QuestionAction action = new QuestionAction(this, this.tipsItem,
				this.goItem);
		
	}
	
	public void setAnswer(String[] ans)
	{
		//TODO
		this.answer = ans;
		
	}
	
	public void setQuestion(String ques)
	{
		//TODO
		this.question = ques;
		
	}
	
	private String[]	answer	= { "A.服务态度", "B.饭菜口味", "C.卫生状况", "D.交通时间" };
	
	private ChoiceGroup	answerGroup;
	
	private ImageItem	goItem;
	
	private String		question;
	
	private StringItem	questionItem;
	
	private ImageItem	tipsItem;
	
}
